package gam.n1.cm.i;

import gam.n1.areas.Area;
import gam.n1.areas.AreaManager;
import gam.n1.conf.ConfManager;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;

public class AreaRunHandler extends BaseHandler{
    public AreaRunHandler(Plugin plugin) {
        super(plugin);
    }

    @Override
    public boolean handle(Player player, String[] args) {
        if (args.length == 1) {
            String key = args[0];
            Area area = AreaManager.findArea(key);
            if (area != null) {
                if (AreaManager.j(area)){
                    ConfManager.Msg.send(player,"&6The Area : &e{area} &6is working!","{area}",area.getAreaName());
                } else ConfManager.Msg.send(player,"&4Area startup failed : &5{key}","{key}",key);
            } else ConfManager.Msg.send(player,"&4Area Cannot be found.",null,null);
        }
        return false;
    }
}
